From 72415eaa4913568dbb9c0c433949f120a6a246ab Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 4 Nov 2020 16:43:59 +0000 Subject: [PATCH] a11y: Make the Button labelled by its child label Establish the relation whenever we set the label widget. --- gtk/gtkbutton.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 91023ce39e..f964eb7495 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -938,6 +938,11 @@ gtk_button_set_icon_name (GtkButton *button, gtk_image_set_from_icon_name (GTK_IMAGE (priv->child), icon_name); } + gtk_accessible_update_relation (GTK_ACCESSIBLE (button), + GTK_ACCESSIBLE_RELATION_LABELLED_BY, + g_list_append (NULL, priv->child), + -1); + gtk_button_set_child_type (button, ICON_CHILD); g_object_notify_by_pspec (G_OBJECT (button), props[PROP_ICON_NAME]); } -- 2.30.2